package com.ruan.lkx.service;

import com.alibaba.fastjson.JSONObject;
import com.ruan.lkx.Constants;
import com.ruan.lkx.bean.HotVideo;
import com.ruan.lkx.bean.HotVideoCommon;
import com.ruan.lkx.net.HttpUtils;

import java.util.List;

/**
 * @author: likaixin
 * @emial: 2638784520@qq.com
 * @desc:
 * @datetime: 2021-12-06 19:47
 */
public class HotVideoService {
    /**
    * 该方法用于获取热门数据 并将热门数据返回
     */
  public List<HotVideo> getHotVideo(){
      String url = Constants.TRIP_URL + "?key=" + Constants.TRIP_KEY + "&type=hot_video" + "&size=20";
      String result = HttpUtils.get(url);
      System.out.println(result);
      //JSON解析
      HotVideoCommon hotVideoCommon = JSONObject.parseObject(result, HotVideoCommon.class);

      return hotVideoCommon.result;
  }
}
